有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Android Eclipse在执行时“未找到源”

在编写Android应用程序时,我在Eclipse中遇到了一个问题

如果我处于调试模式,并逐行检查我的代码,我会得到一个错误消息“sourcenotfound”

这是我的密码:

public boolean checkVersion(){
    httpclient = new DefaultHttpClient();
    httppost = new HttpPost("http://"+this.ip+"/fastorder/安卓/checkDatabaseVersion.php"); // make sure the url is correct.
    try{
        String db_vers = String.valueOf(DATABASE_VERSION);
        //add your data
        nameValuePairs = new ArrayList<NameValuePair>();
        // Always use the same variable name for posting i.e the 安卓 side variable name and php side variable name should be similar, 
        nameValuePairs.add(new BasicNameValuePair("version", db_vers));  // $Edittext_value = $_POST['Edittext_value'];


        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        //Execute HTTP Post Request
        //response = httpclient.execute(httppost);

        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String response = httpclient.execute(httppost, responseHandler);
        System.out.println("Response: " + response); 

        if(response.equalsIgnoreCase("true")){


            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
                // set title
                alertDialogBuilder.setTitle("Speisekarte aktualisieren?");

                // set dialog message
                alertDialogBuilder
                    .setMessage("Wollen Sie jetzt die aktuelle Version der Speisekarte downloaden?")
                    .setCancelable(false)
                    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,int id) {
                            loadUpdate();
                        }
                      })
                    .setNegativeButton("No",new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,int id) {
                            // if this button is clicked, just close
                            // the dialog box and do nothing
                            dialog.cancel();
                        }
                    });

                    // create alert dialog
                    AlertDialog alertDialog = alertDialogBuilder.create();

                    // show it
                    alertDialog.show();


        }
        else if(response.equalsIgnoreCase("false")){

        }

    }catch(ClientProtocolException e){
        Log.e("FastOrder", "Exception : " + e);
    }catch(IOException e){
        Log.e("FastOrder", "Exception : " + e);
    }

    return true;
}

错误出现在:String response = httpclient.execute(httppost, responseHandler);

有人有答案吗?我从几天起就试图解决这个问题


共 (1) 个答案

  1. # 1 楼答案

    这是因为找不到您试图访问的方法的源代码

    尝试在出现错误的行中按[F6]